﻿Imports Tohto.Base.CommonConst
Imports Tohto.Base.ComUtility
Imports FarPoint.Web
Imports AjaxControlToolkit
Imports Tohto.Web.BLL

Public Class KR0060P01
    Inherits CMBasePage

#Region "定数"

    ''' <summary>
    ''' 画面名称
    ''' </summary>
    ''' <remarks></remarks>
    Private Const PAGE_NM As String = "出金一覧.csv"

    ''' <summary>
    ''' 戻る
    ''' </summary>
    ''' <remarks></remarks>
    Public goBack As String = String.Empty

    ''' <summary>
    ''' 画面ID
    ''' </summary>
    ''' <remarks></remarks>
    Private Const PAGE_ID As String = "KR0060P01"

    ''' <summary>
    ''' 出金一覧テーブル
    ''' </summary>
    ''' <remarks></remarks>
    Private Const OUTKIN_TABLE As String = "_OUTKIN_TABLE"

    Private Enum SPRE_COL
        SHUKKIN_NO = 0
        SHUKKIN_DT
        SHUKKIN_POST_CD
        SHUKKIN_POST_NM
        SHUKKIN_CUST_CD
        SHUKKIN_CUST_NM
        SHUKKIN_HOHO_KB
        SHUKKIN_HOHO
        ACCOUNT_COMPA_CD
        ACCOUNT_COMPA_NM
        SIHARAI_KINGAKU
        MISHUKKIN_KINGAKU
        SHUKKIN_KINGAKU
        KOJI_POST_CD
        KOJI_POST_NM
        KOJI_EMP_CD
        KOJI_EMP_NM
        KOJI_KB
        KOJI_KB_NM
        KOJI_NO
        KOJI_NM
        ARTICLE_CD
        ARTICLE_NM
        ROOM_CD
        ROOM_NM

    End Enum

#End Region

#Region "フォームロードイベント"

    ''' <summary>
    ''' フォームロード
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        'ページ名称をセット
        DirectCast(Me.Master, MainMaster).pageName = PAGE_NM

        Try

            'エラーメッセージリストの初期化
            Call ErrMessageInit()

            If Not IsPostBack Then

                '画面の初期化
                Call PageInit()

                If MyBase.isGoBack Then
                    '遷移先から戻る場合
                    Call GoBackInputInit()

                    '伝票一覧を呼び出し
                    Call GetOutKinData()

                End If

            End If

        Catch ex As Exception
            MyBase.ProcessException(ex, ComConst.EX_HANLDER_UI)
        End Try
    End Sub

#End Region

#Region "ボタンクリックイベント"

    ''' <summary>
    ''' 検索ボタンを押下する場合
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Protected Sub btn_search_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_search.Click
        Try

            Call MyBase.ErrMsgAreaClear()

            '伝票一覧データ取得を呼び出し、結果を取得する。
            Call GetOutKinData()

            '画面を遷移する、ページの値をテーブルに保存する　
            Dim gamenValue As DataTable = SaveFormValue()
            Session.Add(ComConst.GAMEN_ID.OUTKIN_NYURYOKU & OUTKIN_TABLE, gamenValue)

        Catch ex As Exception
            MyBase.ProcessException(ex, ComConst.EX_HANLDER_UI)
        End Try
    End Sub

    ''' <summary>
    ''' クリアボタンを押下する場合
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Protected Sub but_clear_Click(ByVal sender As Object, ByVal e As EventArgs) Handles but_clear.Click
        Try

            '画面のクリア
            Call PageClear()

        Catch ex As Exception
            MyBase.ProcessException(ex, ComConst.EX_HANLDER_UI)
        End Try
    End Sub

    ''' <summary>
    ''' CSVボタンを押下する場合
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Protected Sub btn_csv_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_csv.Click
        Try

            Call MyBase.ErrMsgAreaClear()

            'CSVファイルに出力する。
            Dim scmMain As ToolkitScriptManager = DirectCast(DirectCast(Me.Master, MainMaster).FindControl("scmMain"), ToolkitScriptManager)
            Dim needCsv As HiddenField = DirectCast(DirectCast(Me.Master, MainMaster).FindControl("hidNeedCsv"), HiddenField)
            Call scmMain.RegisterDataItem(needCsv, "true")

            Session.Add(ComConst.SEE_CSV_SPREADVIEW, Me.sp_OutKin.ActiveSheetView)
            Session.Add(ComConst.SEE_CSV_FILENM, PAGE_NM)

        Catch ex As Exception
            MyBase.ProcessException(ex, ComConst.EX_HANLDER_UI)
        End Try
    End Sub

#End Region

#Region "スプレッドクリックイベント"

    ''' <summary>
    ''' 工事チェッカーの番号、工事名を押下する場合
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Protected Sub sp_kojityeka_ButtonCommand(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.SpreadCommandEventArgs) Handles sp_OutKin.ButtonCommand
        Try

            Dim intRow As Integer = DirectCast(e.CommandArgument, System.Drawing.Point).X
            Dim intCol As Integer = DirectCast(e.CommandArgument, System.Drawing.Point).Y

            If intCol = SPRE_COL.SHUKKIN_NO Then

                'Dim dt_OutKin As DataTable = GetTestData()
                Dim dt_OutKin As DataTable = Get_OutKin()
                Dim SHUKKIN_NO As String = CStr(dt_OutKin.Rows(intRow).Item("SHUKKIN_NO"))

                Response.Redirect(ComConst.GAMEN_ID.OUTKIN_NYURYOKU & ".aspx?" & _
                                  ComConst.GAMEN_MODE & "=" & Server.UrlDecode(ComConst.MODE_EDITABLE) & "&" & _
                                  ComConst.QUERY_SHUKKIN_NO & "=" & Server.UrlDecode(SHUKKIN_NO), False)
            End If
        Catch ex As Exception
            MyBase.ProcessException(ex, ComConst.EX_HANLDER_UI)
        End Try
    End Sub

#End Region

#Region "ソメッド"

    ''' <summary>
    ''' エラーメッセージリストの初期化
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ErrMessageInit()

        'CME0055	From≦Toで入力してください。
        arrErrorCdList.Add("CME0055")
        'CMI0003	検索データが０件です。
        arrErrorCdList.Add("CME0003")
        'CME0022	%FieldName%は有効な日時ではありません。
        arrErrorCdList.Add("CME0022")
        'CME0065	条件指示部の項目が一つも入力されていない
        arrErrorCdList.Add("CME0065")

        'クライアントにポープメッセージ共通をレジスト        MyBase.RegistErrorCdToForm()
    End Sub

    ''' <summary>
    ''' 画面の初期化
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub PageInit()

        '共通ボタンのリセット
        SetComBtnState(False, False, False, False, False)

        '端末情報の制御
        Call MyBase.SetTanmatuState(False, False)

        '戻る
        Call SetGoBackUrl(Request, PAGE_ID)

        'コンボをセット
        Call SetCmbBox()

        '画面クリア
        Call PageClear()


        '日付フォーカスイベントをセット
        MyBase.RegistHidukeScript(txt_OutKin_ymd_from, True)     '完了予定日(From)
        MyBase.RegistHidukeScript(txt_OutKin_ymd_to, True)       '完了予定日(To)
        MyBase.RegistHidukeScriptForFromTo(txt_OutKin_ymd_from, txt_OutKin_ymd_to)

        'スプレッドＣＳＳ
        MyBase.SetSpreadDefaultStyle(Me.sp_OutKin, True)

    End Sub

    ''' <summary>
    ''' 画面のクリア
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub PageClear()

        'エラーメッセージ領域のクリア
        Call MyBase.ErrMsgAreaClear()

        Me.sp_OutKin.ActiveSheetView.RowCount = 0                                             '工事チェッカ


        '出金日
        Me.txt_OutKin_ymd_from.Text = Format(MyBase.GetSystemDate, "yyyy/MM/01")
        Me.txt_OutKin_ymd_to.Text = Format(DateAdd(DateInterval.Day, -1, CDate(Format(DateAdd(DateInterval.Month, 1, MyBase.GetSystemDate), "yyyy/MM/01"))), "yyyy/MM/dd")
        '出金部署
        Me.ddl_OutKinpost_cd.SelectedValue = MyBase.sessionUserInfo.POST_CD
        '出金方法

        Me.ddl_OutKinHoho.SelectedValue = ""
        '出金元口座
        Me.txt_kouza_cd.Text = String.Empty
        Me.txt_kouza_nm.Text = String.Empty
        '
        Me.txt_mei1.Text = String.Empty
        Me.txt_mei2.Text = String.Empty
        Me.txt_mei3.Text = String.Empty
        '
        Me.txt_kojiNo.Text = String.Empty

        Me.txt_OutKin_ymd_from.Focus()                                                                   '出金日

    End Sub

    ''' <summary>
    ''' コンボボックスをセット
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub SetCmbBox()

        'コンボボックス初期化

        '出金部署
        Call InitDropDownList(ComConst.CMB_BUSYO, ddl_OutKinpost_cd)
        '出金方法

        Call InitDropDownList(ComConst.CMB_KB, ddl_OutKinHoho, ComConst.KUBUN.KR010)

    End Sub

    ''' <summary>
    ''' 一覧データ取得を呼び出し、結果を取得する。
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub GetOutKinData()
        '伝票一覧データを取得します。

        'Dim dtOutKin As DataTable = GetTestData()
        '伝票一覧データを取得します。
        Dim dtOutKin As DataTable = Get_OutKin()

        If dtOutKin.Rows.Count = 0 Then
            MyBase.SetMsgArea("CMI0003")
            Me.sp_OutKin.Rows.Count = 0
            Me.txt_OutKin_ymd_from.Focus()
            Return
        End If


        'スプレッドチェック項目を取得します。        Dim denpyoClick() As Integer
        denpyoClick = CType(Session(ComConst.GAMEN_ID.KOUJI_ANKEN_NYURYOKU & "SHUKKIN_NO"), Integer())

        sp_OutKin.Rows.Count = dtOutKin.Rows.Count

        'セルのタイプの設定        Call CreatSPCell()

        '工事進捗スプレッドに値を与える

        For i As Integer = 0 To dtOutKin.Rows.Count - 1
            With dtOutKin.Rows(i)
                Dim spButtonLink As New Spread.ButtonCellType
                spButtonLink.ButtonType = Spread.ButtonType.LinkButton
                spButtonLink.Text = Util.ObjToString(.Item("SHUKKIN_NO"))        '
                Me.sp_OutKin.Cells(i, SPRE_COL.SHUKKIN_NO).CellType = spButtonLink

                Me.sp_OutKin.Cells(i, SPRE_COL.SHUKKIN_NO).Value = .Item("SHUKKIN_NO")
                Me.sp_OutKin.Cells(i, SPRE_COL.SHUKKIN_DT).Value = .Item("SHUKKIN_DT")
                Me.sp_OutKin.Cells(i, SPRE_COL.SHUKKIN_POST_CD).Value = .Item("SHUKKIN_POST_CD")
                Me.sp_OutKin.Cells(i, SPRE_COL.SHUKKIN_POST_NM).Value = .Item("SHUKKIN_POST_NM")
                Me.sp_OutKin.Cells(i, SPRE_COL.SHUKKIN_CUST_CD).Value = .Item("SHUKKIN_CUST_CD")
                Me.sp_OutKin.Cells(i, SPRE_COL.SHUKKIN_CUST_NM).Value = .Item("SHUKKIN_CUST_NM")
                Me.sp_OutKin.Cells(i, SPRE_COL.SHUKKIN_HOHO_KB).Value = .Item("SHUKKIN_HOHO_KB")
                Me.sp_OutKin.Cells(i, SPRE_COL.SHUKKIN_HOHO).Value = .Item("SHUKKIN_HOHO")
                Me.sp_OutKin.Cells(i, SPRE_COL.ACCOUNT_COMPA_CD).Value = .Item("ACCOUNT_COMPA_CD")
                Me.sp_OutKin.Cells(i, SPRE_COL.ACCOUNT_COMPA_NM).Value = .Item("ACCOUNT_COMPA_NM")
                Me.sp_OutKin.Cells(i, SPRE_COL.SIHARAI_KINGAKU).Value = .Item("SIHARAI_KINGAKU")
                Me.sp_OutKin.Cells(i, SPRE_COL.MISHUKKIN_KINGAKU).Value = .Item("MISHUKKIN_KINGAKU")
                Me.sp_OutKin.Cells(i, SPRE_COL.SHUKKIN_KINGAKU).Value = .Item("SHUKKIN_KINGAKU")
                Me.sp_OutKin.Cells(i, SPRE_COL.KOJI_POST_CD).Value = .Item("KOJI_POST_CD")
                Me.sp_OutKin.Cells(i, SPRE_COL.KOJI_POST_NM).Value = .Item("KOJI_POST_NM")
                Me.sp_OutKin.Cells(i, SPRE_COL.KOJI_EMP_CD).Value = .Item("KOJI_EMP_CD")
                Me.sp_OutKin.Cells(i, SPRE_COL.KOJI_EMP_NM).Value = .Item("KOJI_EMP_NM")
                Me.sp_OutKin.Cells(i, SPRE_COL.KOJI_KB).Value = .Item("KOJI_KB")
                Me.sp_OutKin.Cells(i, SPRE_COL.KOJI_KB_NM).Value = .Item("KOJI_KB_NM")
                Me.sp_OutKin.Cells(i, SPRE_COL.KOJI_NO).Value = .Item("KOJI_NO")
                Me.sp_OutKin.Cells(i, SPRE_COL.KOJI_NM).Value = .Item("KOJI_NM")
                Me.sp_OutKin.Cells(i, SPRE_COL.ARTICLE_CD).Value = .Item("ARTICLE_CD")
                Me.sp_OutKin.Cells(i, SPRE_COL.ARTICLE_NM).Value = .Item("ARTICLE_NM")
                Me.sp_OutKin.Cells(i, SPRE_COL.ROOM_CD).Value = .Item("ROOM_CD")
                Me.sp_OutKin.Cells(i, SPRE_COL.ROOM_NM).Value = .Item("ROOM_NM")
            End With

        Next

    End Sub

    ''' <summary>
    ''' 伝票一覧スプレッドを作成
    ''' </summary>
    ''' <param name="spReset"></param>
    ''' <param name="intRowCount"></param>
    ''' <remarks></remarks>
    Private Sub CreatSPCell()

        Dim spLabel As Spread.LabelCellType = Nothing
        Dim spInteger As Spread.IntegerCellType = Nothing
        Dim spDateTime As Spread.DateTimeCellType = Nothing

        Dim spNumberFormat As New System.Globalization.NumberFormatInfo
        spNumberFormat.NumberDecimalDigits = 0
        spNumberFormat.NumberDecimalSeparator = ","

        For i As Integer = 0 To sp_OutKin.Rows.Count - 1
            With sp_OutKin
                'セルのタイプの設定

                'spLabel = New Spread.LabelCellType
                '.Cells(i, SPRE_COL.SHUKKIN_NO).CellType = spLabel
                '.Cells(i, SPRE_COL.SHUKKIN_NO).Locked = True
                '.Cells(i, SPRE_COL.SHUKKIN_NO).HorizontalAlign = HorizontalAlign.Left
                '.Cells(i, SPRE_COL.SHUKKIN_NO).VerticalAlign = VerticalAlign.Middle

                spDateTime = New Spread.DateTimeCellType
                .Cells(i, SPRE_COL.SHUKKIN_DT).CellType = spDateTime
                .Cells(i, SPRE_COL.SHUKKIN_DT).Locked = True
                .Cells(i, SPRE_COL.SHUKKIN_DT).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.SHUKKIN_DT).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.SHUKKIN_POST_CD).CellType = spLabel
                .Cells(i, SPRE_COL.SHUKKIN_POST_CD).Locked = True
                .Cells(i, SPRE_COL.SHUKKIN_POST_CD).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.SHUKKIN_POST_CD).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.SHUKKIN_POST_NM).CellType = spLabel
                .Cells(i, SPRE_COL.SHUKKIN_POST_NM).Locked = True
                .Cells(i, SPRE_COL.SHUKKIN_POST_NM).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.SHUKKIN_POST_NM).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.SHUKKIN_CUST_CD).CellType = spLabel
                .Cells(i, SPRE_COL.SHUKKIN_CUST_CD).Locked = True
                .Cells(i, SPRE_COL.SHUKKIN_CUST_CD).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.SHUKKIN_CUST_CD).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.SHUKKIN_CUST_NM).CellType = spLabel
                .Cells(i, SPRE_COL.SHUKKIN_CUST_NM).Locked = True
                .Cells(i, SPRE_COL.SHUKKIN_CUST_NM).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.SHUKKIN_CUST_NM).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.SHUKKIN_HOHO_KB).CellType = spLabel
                .Cells(i, SPRE_COL.SHUKKIN_HOHO_KB).Locked = True
                .Cells(i, SPRE_COL.SHUKKIN_HOHO_KB).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.SHUKKIN_HOHO_KB).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.SHUKKIN_HOHO).CellType = spLabel
                .Cells(i, SPRE_COL.SHUKKIN_HOHO).Locked = True
                .Cells(i, SPRE_COL.SHUKKIN_HOHO).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.SHUKKIN_HOHO).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.ACCOUNT_COMPA_CD).CellType = spLabel
                .Cells(i, SPRE_COL.ACCOUNT_COMPA_CD).Locked = True
                .Cells(i, SPRE_COL.ACCOUNT_COMPA_CD).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.ACCOUNT_COMPA_CD).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.ACCOUNT_COMPA_NM).CellType = spLabel
                .Cells(i, SPRE_COL.ACCOUNT_COMPA_NM).Locked = True
                .Cells(i, SPRE_COL.ACCOUNT_COMPA_NM).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.ACCOUNT_COMPA_NM).VerticalAlign = VerticalAlign.Middle

                spInteger = New Spread.IntegerCellType
                spInteger.NumberFormat = spNumberFormat
                .Cells(i, SPRE_COL.SIHARAI_KINGAKU).CellType = spInteger
                .Cells(i, SPRE_COL.SIHARAI_KINGAKU).Locked = True
                .Cells(i, SPRE_COL.SIHARAI_KINGAKU).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.SIHARAI_KINGAKU).VerticalAlign = VerticalAlign.Middle

                spInteger = New Spread.IntegerCellType
                spInteger.NumberFormat = spNumberFormat
                .Cells(i, SPRE_COL.MISHUKKIN_KINGAKU).CellType = spInteger
                .Cells(i, SPRE_COL.MISHUKKIN_KINGAKU).Locked = True
                .Cells(i, SPRE_COL.MISHUKKIN_KINGAKU).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.MISHUKKIN_KINGAKU).VerticalAlign = VerticalAlign.Middle

                spInteger = New Spread.IntegerCellType
                spInteger.NumberFormat = spNumberFormat
                .Cells(i, SPRE_COL.SHUKKIN_KINGAKU).CellType = spInteger
                .Cells(i, SPRE_COL.SHUKKIN_KINGAKU).Locked = True
                .Cells(i, SPRE_COL.SHUKKIN_KINGAKU).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.SHUKKIN_KINGAKU).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.KOJI_POST_CD).CellType = spLabel
                .Cells(i, SPRE_COL.KOJI_POST_CD).Locked = True
                .Cells(i, SPRE_COL.KOJI_POST_CD).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.KOJI_POST_CD).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.KOJI_POST_NM).CellType = spLabel
                .Cells(i, SPRE_COL.KOJI_POST_NM).Locked = True
                .Cells(i, SPRE_COL.KOJI_POST_NM).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.KOJI_POST_NM).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.KOJI_EMP_CD).CellType = spLabel
                .Cells(i, SPRE_COL.KOJI_EMP_CD).Locked = True
                .Cells(i, SPRE_COL.KOJI_EMP_CD).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.KOJI_EMP_CD).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.KOJI_EMP_NM).CellType = spLabel
                .Cells(i, SPRE_COL.KOJI_EMP_NM).Locked = True
                .Cells(i, SPRE_COL.KOJI_EMP_NM).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.KOJI_EMP_NM).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.KOJI_KB).CellType = spLabel
                .Cells(i, SPRE_COL.KOJI_KB).Locked = True
                .Cells(i, SPRE_COL.KOJI_KB).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.KOJI_KB).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.KOJI_KB_NM).CellType = spLabel
                .Cells(i, SPRE_COL.KOJI_KB_NM).Locked = True
                .Cells(i, SPRE_COL.KOJI_KB_NM).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.KOJI_KB_NM).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.KOJI_NO).CellType = spLabel
                .Cells(i, SPRE_COL.KOJI_NO).Locked = True
                .Cells(i, SPRE_COL.KOJI_NO).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.KOJI_NO).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.KOJI_NM).CellType = spLabel
                .Cells(i, SPRE_COL.KOJI_NM).Locked = True
                .Cells(i, SPRE_COL.KOJI_NM).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.KOJI_NM).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.ARTICLE_CD).CellType = spLabel
                .Cells(i, SPRE_COL.ARTICLE_CD).Locked = True
                .Cells(i, SPRE_COL.ARTICLE_CD).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.ARTICLE_CD).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.ARTICLE_NM).CellType = spLabel
                .Cells(i, SPRE_COL.ARTICLE_NM).Locked = True
                .Cells(i, SPRE_COL.ARTICLE_NM).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.ARTICLE_NM).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.ROOM_CD).CellType = spLabel
                .Cells(i, SPRE_COL.ROOM_CD).Locked = True
                .Cells(i, SPRE_COL.ROOM_CD).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.ROOM_CD).VerticalAlign = VerticalAlign.Middle

                spLabel = New Spread.LabelCellType
                .Cells(i, SPRE_COL.ROOM_NM).CellType = spLabel
                .Cells(i, SPRE_COL.ROOM_NM).Locked = True
                .Cells(i, SPRE_COL.ROOM_NM).HorizontalAlign = HorizontalAlign.Left
                .Cells(i, SPRE_COL.ROOM_NM).VerticalAlign = VerticalAlign.Middle

            End With
        Next

    End Sub

    ''' <summary>
    ''' 伝票一覧データテーブル
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Function GetTestData() As DataTable

        Dim dt As New DataTable
        'dt.Columns.Add("ROWID", Type.GetType("System.String"))                '
        dt.Columns.Add("SHUKKIN_NO", Type.GetType("System.String"))             '出金No.												
        dt.Columns.Add("SHUKKIN_DT", Type.GetType("System.DateTime"))           '出金日												
        dt.Columns.Add("SHUKKIN_POST_CD", Type.GetType("System.String"))        '非表示項目（出金部署CD）

        dt.Columns.Add("SHUKKIN_POST_NM", Type.GetType("System.String"))        '出金部署												
        dt.Columns.Add("SHUKKIN_CUST_CD", Type.GetType("System.String"))        '出金顧客CD												
        dt.Columns.Add("SHUKKIN_CUST_NM", Type.GetType("System.String"))        '出金顧客名												
        dt.Columns.Add("SHUKKIN_HOHO_KB", Type.GetType("System.String"))        '非表示項目（出金方法CD）

        dt.Columns.Add("SHUKKIN_HOHO", Type.GetType("System.String"))           '出金方法												
        dt.Columns.Add("ACCOUNT_COMPA_CD", Type.GetType("System.String"))       '非表示項目（出金元口座CD）

        dt.Columns.Add("ACCOUNT_COMPA_NM", Type.GetType("System.String"))       '出金元口座												
        dt.Columns.Add("SIHARAI_KINGAKU", Type.GetType("System.Decimal"))       '支払額												
        dt.Columns.Add("MISHUKKIN_KINGAKU", Type.GetType("System.Decimal"))     '未出金額												
        dt.Columns.Add("SHUKKIN_KINGAKU", Type.GetType("System.Decimal"))       '出金額												
        dt.Columns.Add("KOJI_POST_CD", Type.GetType("System.String"))           '非表示項目（工事部署CD）

        dt.Columns.Add("KOJI_POST_NM", Type.GetType("System.String"))           '工事部署												
        dt.Columns.Add("KOJI_EMP_CD", Type.GetType("System.String"))            '非表示項目（工事担当者CD）

        dt.Columns.Add("KOJI_EMP_NM", Type.GetType("System.String"))            '工事担当者												
        dt.Columns.Add("KOJI_KB", Type.GetType("System.String"))                '非表示項目（工事区分CD）

        dt.Columns.Add("KOJI_KB_NM", Type.GetType("System.String"))             '工事区分												
        dt.Columns.Add("KOJI_NO", Type.GetType("System.String"))                '工事No.												
        dt.Columns.Add("KOJI_NM", Type.GetType("System.String"))                '工事名												
        dt.Columns.Add("ARTICLE_CD", Type.GetType("System.String"))             '物件CD												
        dt.Columns.Add("ARTICLE_NM", Type.GetType("System.String"))             '物件名												
        dt.Columns.Add("ROOM_CD", Type.GetType("System.String"))                '部屋CD												
        dt.Columns.Add("ROOM_NM", Type.GetType("System.String"))                '部屋名												

        Dim dr As DataRow = dt.NewRow
        dr("SHUKKIN_NO") = "1000000001"
        dr("SHUKKIN_DT") = Now.Date
        dr("SHUKKIN_POST_CD") = "0107"
        dr("SHUKKIN_POST_NM") = "出金部署"
        dr("SHUKKIN_CUST_CD") = "101"
        dr("SHUKKIN_CUST_NM") = "出金顧客名"
        dr("SHUKKIN_HOHO_KB") = "102"
        dr("SHUKKIN_HOHO") = "出金方法"
        dr("ACCOUNT_COMPA_CD") = "103"
        dr("ACCOUNT_COMPA_NM") = "出金元口座"
        dr("SIHARAI_KINGAKU") = "1000"
        dr("MISHUKKIN_KINGAKU") = "10000"
        dr("SHUKKIN_KINGAKU") = "100000"
        dr("KOJI_POST_CD") = "104"
        dr("KOJI_POST_NM") = "工事部署"
        dr("KOJI_EMP_CD") = "105"
        dr("KOJI_EMP_NM") = "工事担当者"
        dr("KOJI_KB") = "106"
        dr("KOJI_KB_NM") = "工事区分"
        dr("KOJI_NO") = "107"
        dr("KOJI_NM") = "工事名"
        dr("ARTICLE_CD") = "108"
        dr("ARTICLE_NM") = "物件名"
        dr("ROOM_CD") = "109"
        dr("ROOM_NM") = "部屋名"
        dt.Rows.Add(dr)

        dr = dt.NewRow
        dr("SHUKKIN_NO") = "2000000001"
        dr("SHUKKIN_DT") = DateAdd(DateInterval.Day, 1, Now).Date
        dr("SHUKKIN_POST_CD") = "0107"
        dr("SHUKKIN_POST_NM") = "出金部署"
        dr("SHUKKIN_CUST_CD") = "201"
        dr("SHUKKIN_CUST_NM") = "出金顧客名"
        dr("SHUKKIN_HOHO_KB") = "202"
        dr("SHUKKIN_HOHO") = "出金方法"
        dr("ACCOUNT_COMPA_CD") = "203"
        dr("ACCOUNT_COMPA_NM") = "出金元口座"
        dr("SIHARAI_KINGAKU") = "2000"
        dr("MISHUKKIN_KINGAKU") = "20000"
        dr("SHUKKIN_KINGAKU") = "200000"
        dr("KOJI_POST_CD") = "204"
        dr("KOJI_POST_NM") = "工事部署"
        dr("KOJI_EMP_CD") = "205"
        dr("KOJI_EMP_NM") = "工事担当者"
        dr("KOJI_KB") = "206"
        dr("KOJI_KB_NM") = "工事区分"
        dr("KOJI_NO") = "207"
        dr("KOJI_NM") = "工事名"
        dr("ARTICLE_CD") = "208"
        dr("ARTICLE_NM") = "物件名"
        dr("ROOM_CD") = "209"
        dr("ROOM_NM") = "部屋名"
        dt.Rows.Add(dr)


        dr = dt.NewRow
        dr("SHUKKIN_NO") = "3000000001"
        dr("SHUKKIN_DT") = DateAdd(DateInterval.Day, 2, Now).Date
        dr("SHUKKIN_POST_CD") = "0107"
        dr("SHUKKIN_POST_NM") = "出金部署"
        dr("SHUKKIN_CUST_CD") = "301"
        dr("SHUKKIN_CUST_NM") = "出金顧客名"
        dr("SHUKKIN_HOHO_KB") = "302"
        dr("SHUKKIN_HOHO") = "出金方法"
        dr("ACCOUNT_COMPA_CD") = "303"
        dr("ACCOUNT_COMPA_NM") = "出金元口座"
        dr("SIHARAI_KINGAKU") = "3000"
        dr("MISHUKKIN_KINGAKU") = "30000"
        dr("SHUKKIN_KINGAKU") = "300000"
        dr("KOJI_POST_CD") = "304"
        dr("KOJI_POST_NM") = "工事部署"
        dr("KOJI_EMP_CD") = "305"
        dr("KOJI_EMP_NM") = "工事担当者"
        dr("KOJI_KB") = "306"
        dr("KOJI_KB_NM") = "工事区分"
        dr("KOJI_NO") = "307"
        dr("KOJI_NM") = "工事名"
        dr("ARTICLE_CD") = "308"
        dr("ARTICLE_NM") = "物件名"
        dr("ROOM_CD") = "309"
        dr("ROOM_NM") = "部屋名"
        dt.Rows.Add(dr)


        dr = dt.NewRow
        dr("SHUKKIN_NO") = "4000000001"
        dr("SHUKKIN_DT") = DateAdd(DateInterval.Day, 3, Now).Date
        dr("SHUKKIN_POST_CD") = "0107"
        dr("SHUKKIN_POST_NM") = "出金部署"
        dr("SHUKKIN_CUST_CD") = "401"
        dr("SHUKKIN_CUST_NM") = "出金顧客名"
        dr("SHUKKIN_HOHO_KB") = "402"
        dr("SHUKKIN_HOHO") = "出金方法"
        dr("ACCOUNT_COMPA_CD") = "303"
        dr("ACCOUNT_COMPA_NM") = "出金元口座"
        dr("SIHARAI_KINGAKU") = "4000"
        dr("MISHUKKIN_KINGAKU") = "40000"
        dr("SHUKKIN_KINGAKU") = "400000"
        dr("KOJI_POST_CD") = "404"
        dr("KOJI_POST_NM") = "工事部署"
        dr("KOJI_EMP_CD") = "405"
        dr("KOJI_EMP_NM") = "工事担当者"
        dr("KOJI_KB") = "406"
        dr("KOJI_KB_NM") = "工事区分"
        dr("KOJI_NO") = "407"
        dr("KOJI_NM") = "工事名"
        dr("ARTICLE_CD") = "408"
        dr("ARTICLE_NM") = "物件名"
        dr("ROOM_CD") = "409"
        dr("ROOM_NM") = "部屋名"
        dt.Rows.Add(dr)

        Return dt

    End Function

    Private Sub GoBackInputInit()

        Dim dt As DataTable = CType(Session(ComConst.GAMEN_ID.OUTKIN_NYURYOKU & OUTKIN_TABLE), DataTable)

        With dt.Rows(0)
            Me.txt_OutKin_ymd_from.Text = Format(Util.ObjToString(.Item("I_DT_SHUKKIN_DT_FRM")), "yyyy/MM/dd")           '画面．出金日（FROM)
            Me.txt_OutKin_ymd_to.Text = Format(Util.ObjToString(.Item("I_DT_SHUKKIN_DT_TO")), "yyyy/MM/dd")                '画面．出金日（TO)
            Me.ddl_OutKinpost_cd.SelectedValue = Util.ObjToString(.Item("I_VC_SHUKKIN_POST_CD"))    '画面．出金部署(共通部品．部署リスト取得．CD)
            Me.ddl_OutKinHoho.SelectedValue = Util.ObjToString(.Item("I_VC_SHUKKIN_HOHO_KB"))       '画面．出金方法（'KR010',KB）

            Me.txt_kouza_cd.Text = Util.ObjToString(.Item("I_VC_ACCOUNT_COMPA_CD"))                 '画面．出金元口座（CD)
            Me.txt_mei1.Text = Util.ObjToString(.Item("I_VC_ARTICLE_KNM"))                          '画面．物件名(カナ)
            Me.txt_mei2.Text = Util.ObjToString(.Item("I_VC_ROOM_NM"))                              '画面．部屋名(漢字)
            Me.txt_mei3.Text = Util.ObjToString(.Item("I_VC_CUSTOMER_KNM"))                         '画面．顧客名(カナ)
            Me.txt_kojiNo.Text = Util.ObjToString(.Item("I_VC_KOJI_NO"))                            '画面．工事No

        End With
    End Sub

    ''' <summary>
    ''' 保存画面の値
    ''' </summary>
    ''' <remarks></remarks>
    Private Function SaveFormValue() As DataTable

        Dim dt As New DataTable

        dt.Columns.Add("I_DT_SHUKKIN_DT_FRM", Type.GetType("System.DateTime"))          '画面．出金日（FROM)
        dt.Columns.Add("I_DT_SHUKKIN_DT_TO", Type.GetType("System.DateTime"))           '画面．出金日（TO)
        dt.Columns.Add("I_VC_SHUKKIN_POST_CD", Type.GetType("System.String"))           '画面．出金部署(共通部品．部署リスト取得．CD)
        dt.Columns.Add("I_VC_SHUKKIN_HOHO_KB", Type.GetType("System.String"))           '画面．出金方法（'KR010',KB）

        dt.Columns.Add("I_VC_ACCOUNT_COMPA_CD", Type.GetType("System.String"))          '画面．出金元口座（CD)
        dt.Columns.Add("I_VC_ARTICLE_KNM", Type.GetType("System.String"))               '画面．物件名(カナ)
        dt.Columns.Add("I_VC_ROOM_NM", Type.GetType("System.String"))                   '画面．部屋名(漢字)
        dt.Columns.Add("I_VC_CUSTOMER_KNM", Type.GetType("System.String"))              '画面．顧客名(カナ)
        dt.Columns.Add("I_VC_KOJI_NO", Type.GetType("System.String"))                   '画面．工事No

        Dim dr As DataRow = dt.NewRow
        dr("I_DT_SHUKKIN_DT_FRM") = KR0060P01B01.ConvertDBNull(Me.txt_OutKin_ymd_from.Text)             '画面．出金日（FROM)
        dr("I_DT_SHUKKIN_DT_TO") = KR0060P01B01.ConvertDBNull(Me.txt_OutKin_ymd_to.Text)                '画面．出金日（TO)
        dr("I_VC_SHUKKIN_POST_CD") = KR0060P01B01.ConvertDBNull(Me.ddl_OutKinpost_cd.SelectedValue)     '画面．出金部署(共通部品．部署リスト取得．CD)
        dr("I_VC_SHUKKIN_HOHO_KB") = KR0060P01B01.ConvertDBNull(Me.ddl_OutKinHoho.SelectedValue)        '画面．出金方法（'KR010',KB）

        dr("I_VC_ACCOUNT_COMPA_CD") = KR0060P01B01.ConvertDBNull(Me.txt_kouza_cd.Text)                  '画面．出金元口座（CD)
        dr("I_VC_ARTICLE_KNM") = KR0060P01B01.ConvertDBNull(Me.txt_mei1.Text)                           '画面．物件名(カナ)
        dr("I_VC_ROOM_NM") = KR0060P01B01.ConvertDBNull(Me.txt_mei2.Text)                               '画面．部屋名(漢字)
        dr("I_VC_CUSTOMER_KNM") = KR0060P01B01.ConvertDBNull(Me.txt_mei3.Text)                          '画面．顧客名(カナ)
        dr("I_VC_KOJI_NO") = KR0060P01B01.ConvertDBNull(Me.txt_kojiNo.Text)                             '画面．工事No
        dt.Rows.Add(dr)

        Return dt

    End Function

    ''' <summary>
    ''' 伝票一覧データテーブル
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Function Get_OutKin() As DataTable

        Dim loginUser As String = String.Empty
        Dim ErrorInfo As New Base.Entity.PLSQLErrorInfo

        Dim dsRet As DataSet = KR0060P01B01.Fecth_Data(loginUser _
                                                    , Me.txt_OutKin_ymd_from.Text _
                                                    , Me.txt_OutKin_ymd_to.Text _
                                                    , IIf(Val(Me.ddl_OutKinpost_cd.SelectedValue) = 0, "", Me.ddl_OutKinpost_cd.SelectedValue).ToString _
                                                    , IIf(Val(Me.ddl_OutKinHoho.SelectedValue) = 0, "", Me.ddl_OutKinHoho.SelectedValue).ToString _
                                                    , Me.txt_kouza_cd.Text _
                                                    , Me.txt_mei1.Text _
                                                    , Me.txt_mei2.Text _
                                                    , Me.txt_mei3.Text _
                                                    , Me.txt_kojiNo.Text _
                                                    , ErrorInfo)

        Dim dt As DataTable = dsRet.Tables(0)

        Return dt

    End Function

#End Region



End Class